/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ${USER}
 * Date: ${YEAR}-${MONTH}-${DAY}
 * Time: ${TIME}
 */
public class Main {
    public static void main(String[] args) {
        System.out.println("Hello world!");
    }
}
class Solution {
    public ListNode reverseList(ListNode head) {
        if(head == null) return null;
        ListNode cur = head.next;
        ListNode po =new ListNode();
        ListNode phead = head;



        while(cur != null) {
            po = cur.next;
            cur.next = head;
            phead.next = po;
            head = cur;
            cur = po;
        }
        return head;
    }
}